package zcj.stu.dao;

import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Repository;
import zcj.stu.Entity.Account;

import javax.annotation.Resource;
import java.util.List;

@Repository
public class CommonDao {
    @Resource
    private MongoTemplate mongoTemplate;
    public long getTotalCount(Class<Account> classs) {
        return mongoTemplate.count(Query.query(Criteria.where("_id").exists(true)),classs);
    }
    public List queryPage(Query query,Class classs){
        return mongoTemplate.find(query,classs);
    }
}
